package com.example.reagent_management.room.entity;

import java.util.Calendar;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Index;
import androidx.room.PrimaryKey;
/*
* 试剂基本信息
*   indices  索引增加索引速度 文档说是会增加查询速度 ，但会降低插入更新的速度
*   primaryKeys 联合主键保证唯一
*   无论联合主键或联合索引保证唯一都会降低性能
* */

//primaryKeys = {"project_name","reagent_name"}
@Entity(tableName = "reagent_information",
        indices = {@Index(value = {"project_name","reagent_name","type"},unique = true)}
        )
public class ReagentInformation {
    @PrimaryKey(autoGenerate = true)
    private Long reagent_id;
    @ColumnInfo(name = "project_name")
    private String projectName;
    @ColumnInfo(name = "reagent_name")
    private String reagentName;
    @ColumnInfo(name = "time")
    private  Calendar createTime;

    @ColumnInfo(name = "type")
    private String reagentType;


    public ReagentInformation(String projectName, String reagentName, String reagentType) {
        this.projectName = projectName;
        this.reagentName = reagentName;
        this.createTime = Calendar.getInstance();
        this.reagentType = reagentType;
    }

    public Calendar getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Calendar createTime) {
        this.createTime = createTime;
    }

    public Long getReagent_id() {
        return reagent_id;
    }

    public void setReagent_id(Long reagent_id) {
        this.reagent_id = reagent_id;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getReagentName() {
        return reagentName;
    }

    public void setReagentName(String reagentName) {
        this.reagentName = reagentName;
    }


    public String getReagentType() {
        return reagentType;
    }

    public void setReagentType(String reagentType) {
        this.reagentType = reagentType;
    }

    @Override
    public String toString() {
        return "ReagentInformation{" +
                "reagent_id=" + reagent_id +
                ", projectName='" + projectName + '\'' +
                ", reagentName='" + reagentName + '\'' +
                ", createTime=" + createTime +
                ", reagentType=" + reagentType +
                '}';
    }
}
